import { createApp } from 'vue'
import Taro from '@tarojs/taro'

import { store } from '@/stores'
// import Antd from 'ant-design-vue'
// import 'ant-design-vue/dist/antd.css'

// import {
//   Icon,
//   Avatar,
//   Button,
//   SearchBar,
//   Cell,
//   Toast,
//   Form,
//   FormItem,
//   Calendar,
//   Popup,
//   ActionSheet,
//   InfiniteLoading
// } from '@nutui/nutui-taro'
import {
  Icon,
  Avatar,
  Button,
  SearchBar,
  Cell,
  Toast,
  Form,
  FormItem,
  Calendar,
  Popup,
  ActionSheet,
  Tag,
  Pagination
} from '@nutui/nutui'

// import '@nutui/nutui-taro/dist/style.css'
import '@nutui/nutui/dist/styles/themes/default.scss'
import './app.scss'

const App = createApp({
  onShow() {}
  // 入口组件不需要实现 render 方法，即使实现了也会被 taro 所覆盖
})
App.use(Icon)
App.use(Avatar)
App.use(Button)
App.use(SearchBar)
App.use(Cell)
App.use(Toast)
App.use(Form)
App.use(FormItem)
App.use(Calendar)
App.use(Popup)
App.use(ActionSheet)
App.use(Tag)
App.use(Pagination)
// App.use(Antd)

App.use(store)

// wx.setStorageSync

const token = Taro.getStorageSync('token')
if (token === '') {
  setTimeout(() => {
    Taro.navigateTo({ url: '/pages/login/index' })
  }, 50)
}

export default App
